from rest_framework import serializers


def toMppsModelMessage(name, args):
    """
    收到客户新订单通知:
        订单编号{{character_string1.DATA}}
        订单类型{{short_thing6.DATA}}
        客户名称{{thing7.DATA}}
        订单时间{{time2.DATA}}
    下单成功通知:
        订单编号:{{character_string1.DATA}}
        服务类型:{{thing2.DATA}}
        门店名称:{{thing3.DATA}}
        设备编号:{{character_string4.DATA}}
        下单时间:{{time6.DATA}}
    """
    if name == "收到客户新订单通知":
        model = {
            "modid": "t_Pb_6G4NdfKZ8DpC9LoLpSISF9x46xFQrfP520Zcyw",
            "sdata": {
                "character_string1": {"value": args[0]},
                "short_thing6": {"value": args[1]},
                "thing7": {"value": args[2]},
                "time2": {"value": args[3]},
            },
        }
    elif name == "下单成功通知":
        model = {
            "modid": "MHPJSOJrEarxYhSB42EqZWTFLzZp44l1RPdCbKJ-FV8",
            "sdata": {
                "character_string1": {"value": args[0]},
                "thing2": {"value": args[1], "color": "#1D953F"},
                "thing3": {"value": args[2]},
                "character_string4": {"value": args[3]},
                "time6": {"value": args[4]},
            },
        }
    elif name == "新订单提醒":
        model = {
            # 订单编号:{{character_string1.DATA}}
            # 订单时间:{{time4.DATA}}
            # 订单类型:{{thing20.DATA}}
            # 备注说明:{{thing5.DATA}}
            "modid": "T5QNi0SWiuoqqluRGzXIZ35iM8KmE0502mbp2z-vFzE",
            "sdata": {
                "character_string1": {"value": args[0]},
                "time4": {"value": args[1]},
                "thing20": {"value": args[2]},
                "thing5": {"value": args[3]},
            },
        }
    elif name == "抢单提醒":
        model = {
            # 订单编号:{{character_string1.DATA}}
            # 下单时间:{{time4.DATA}}
            # 接单描述:{{thing3.DATA}}
            # 订单金额:{{amount2.DATA}}
            "modid": "S9i-aK4wwo7bBEjhSX8myqEMfYyky3cCW-BnsB0XPf8",
            "sdata": {
                "character_string1": {"value": args[0]},
                "time4": {"value": args[1]},
                "thing3": {"value": args[2]},
                "amount2": {"value": args[3]},
            },
        }
    else:
        model = None

    return model
